<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>个人中心</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta http-equiv="Cache-Control" content="no-transform">
		<meta name="format-detection" content="telephone=no">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<link rel="stylesheet" href="style/css/basic.css" />
		<link rel="stylesheet" href="style/css/agent_my.css" />
		<script type="text/javascript" src="style/plugin/mui/js/mui.min.js"></script>
		<script type="text/javascript" src="style/js/jquery-1.8.3.min.js"></script>
		<script type="text/javascript" src="style/mockjs/dist/mock.js"></script>
		<script type="text/javascript" src="style/js/vue.min.js"></script>
		<script type="text/javascript" src="style/js/vue-resource.js"></script>
		<script type="text/javascript" src="style/js/basic.js"></script>
		<script src="style/js/jquery.form.js"></script>
	</head>  
	<style> 
		.top_bg {
			background: url(style/img/acount_head_bg.png) no-repeat top center;
			;
			background-size: cover;
		} 
		 
		.top_bg h2 {
			text-align: center;
			font-size: 17px;
			line-height: 50px;
			border-bottom: 1px solid #eee;
		}
		
		.top_bg .info_data {
			padding: 0 15px;
			margin-top: 30px;
			position: relative;
		}
		.top_bg a{
			width: 100%;
		}
		.top_bg .name {
			font-weight: 600;
			font-size: 16px;
			color: #444;
			margin-bottom: 10px;
		}
		
		.top_bg .tel {
			color: #999;
		}
		
		.top_bg .info_pic {
			width: 70px;
			height: 70px;
			border: 1px solid #eee;
			margin-right: 20px;
			border-radius: 50%;
			box-shadow: 0px 15px 30px rgba(0, 0, 0, 0.1);
		}
		
		.listli li:first-child {
			margin: 10px 0;
		}
		.loginout{
			margin-top: 10px;
			background: #FFF;
			text-align: center;
			line-height: 44px;
			
		}
		.loginout a{
			color: #2F80ED;
		}
	</style>

	<body>
		<div id="salesMy">
		    <div class="top_bg">
				<div>
					<h2>我的</h2>
				</div>
				<div class="info_data clearfix">
					<a href="javascript:;" id="userbox">
						<div class="info_txt fl">
							<span class="name">销售</span>
							<span class="tel">电话：<em class="telem"></em></span> 
						</div>
						<div class="info_pic fr ">
							<form id="form1" target="nm_iframe" action="http://106.12.201.55/hetai/member/changeHead" method="post" enctype="multipart/form-data"> 
								<img id="headImg">
							    <input type="file" id="upload" style="display:none" name="head"/>	
							    <input type="submit" id="sub" style="display: none;"/>
							</form>
							<iframe id="id_iframe" name="nm_iframe" frameborder="0" style="display: none;"></iframe> 
						</div>
					</a>
				</div>
			</div>
			<div></div>
			<!--list-->
			<div class="listli">
				<ul>
					<li>
						<a href="jacascript:;" class="message">我的消息</a>
					</li>
					<li>
						<a href="javascript:;" class="record">入库核销明细</a>
					</li>
					<li>
						<a href="javascript:;" class="address">我的地址</a>
					</li>
					<li>
						<a href="javascript:;" class="recommend">工单管理</a>
					</li>
					<li>
						<a href="javascript:;" class="intergral">积分明细</a>
					</li>
					<li>
						<a href="javascript:;" class="intergral_order">积分订单</a>
					</li>
					<li>
						<a href="javascript:;" class="altermsg">修改资料</a>
					</li>
					<li>
						<a href="javascript:;" class="service">联系客服</a>
					</li>
				</ul>
				<!--<div class="loginout"><a href="login.html">退出登录</a></div>-->
			</div>	
		</div>
		<!--footer-->
		<div id="footer">
			<ul class="clearfix">
				<li>
					<a href='sales_in_bound.html'><i class="icon_scan"></i><span>待入库</span></a> 
				</li>
				<li>
					<a href="sales_verification.html" target="_blank"><i class="icon_verification"></i><span>核销</span></a>
				</li>
				<li>
					<a href='sales_integral_mall.html' target="_blank"><i class="icon_integral"></i><span>积分</span></a>
				</li>
				<li>
					<a href='sales_my.html' target="_blank"><i class="icon_my"></i><span  class="active_color">我的</span></a>
				</li>
			</ul>
		</div>
		<script>
			mui.plusReady(function(){
				var userbox=document.getElementById("userbox");
				var message=document.getElementsByClassName("message")[0];
				var scanlist=document.getElementsByClassName("scanlist")[0]; 
				var intergral=document.getElementsByClassName("intergral")[0];
				var exit=document.getElementsByClassName("loginout")[0];
				var service=document.getElementsByClassName("service")[0];
				var headImg=document.getElementById("headImg");
				var altermsg=document.getElementsByClassName("altermsg")[0];
				var record=document.getElementsByClassName("record")[0];
				var address=document.getElementsByClassName("address")[0];
				var recommend=document.getElementsByClassName("recommend")[0];
				var intergralOrder=document.getElementsByClassName("intergral_order")[0];
				var ticket=localStorage.getItem("tick")
                var sign=localStorage.getItem("sig")
				mui.ajax(domain+"/member/getInfo?t="+ticket+"&sign="+sign,{//请求用户信息
					data:{
						userId:1
					},
					dataType:"json",
					type:'post',
					timeout:10000,
					success:function(data){
						console.log(data)
						if(data.code==1){
//							userbox.innerHTML=`
//							<div class="info_txt fl">
//								<span class="name">${data.data.nickname}</span>
//								<span class="tel">电话：<em>${data.data.phone}</em></span>
//							</div>
//							<div class="info_pic fr ">
//								<img src="${data.data.head}" id="headImg">
//							</div>
//							`
                            $(".name").html(data.data.nickname);
                            $(".telem").html(data.data.phone);
                            headImg.src=domain2+data.data.head
						}
					}
				}) 
				$("#form1").attr("action",domain+"/member/changeHead?t="+ticket+"&sign="+sign)
				 $("#headImg").click(function(e) {
				 	e.preventDefault();
				 	    e.stopPropagation()
				        $("#upload").click(); //隐藏了input:file样式后，点击头像就可以本地上传
				        $("#upload").on("change", function() {
				            var objUrl = getObjectURL(this.files[0]); //获取图片的路径，该路径不是图片在本地的路径
				            if (objUrl) {
				                $("#headImg").attr("src", objUrl); //将图片路径存入src中，显示出图片
				                upimg();
				                $("#sub").click() 
				            }
				        }); 
				   });
				  //建立一?可存取到?file的url
				    function getObjectURL(file) {
				        var url = null;
				        if (window.createObjectURL != undefined) { // basic
				            url = window.createObjectURL(file);
				        } else if (window.URL != undefined) { // mozilla(firefox)
				            url = window.URL.createObjectURL(file);
				        } else if (window.webkitURL != undefined) { // webkit or chrome
				            url = window.webkitURL.createObjectURL(file);
				        }  
				        return url;
				    }
				  //上传头像到服务器
				    function upimg() { 
                        $("#sub").click(function(){
                        	$("#form1").ajaxSubmit(function(data){
							  console.log(data) 
							  mui.toast(data.msg)
						    })
                        })
				        
				    }
//				exit.addEventListener("tap",function(){//退出登录
//					mui.ajax(domain+"/user/logout?t="+ticket+"&sign="+sign,{
//				    	dataType:"json",
//				    	type:"post",
//				    	timeout:10000,
//				    	headers:{'Content-Type':'application/json'},
//				    	success:function(data){	  
//				    		if(data.code==1){
////				    			alert("1")
//				    			localStorage.clear(); 
//				    			plus.runtime.restart()   
//				    			
//				    		}else if(data.code==0){
//				    			mui.toast("退出失败，请稍后重试",{duration:"short"})
//				    		}
//				    	},
//				    	error:function(xhr,type,errorThrown){
////				    		alert(type)
//				    	}
//				    })
//				})
				jumporder(altermsg,"personal_data.html","") 
				jumporder(message,"message.html","")
//				jumporder(scanlist,"scan_list.html","")
				jumporder(intergral,"integral_subsidiary.html","")
				jumporder(service,"contact_service.html","")
				jumporder(record,"record.html","")
				jumporder(address,"address.html","")
				jumporder(intergralOrder,"integral_order.html","")
				jumporder(recommend,"sales_recommend_manage.html","")
			})
		</script>
	</body>

</html>